<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>变量</title>
</head>
<body>
</body>
<script>
    console.log(parseFloat("123abc"));    //返回123
    console.log(parseFloat("0xA"));       //返回0
    console.log(parseFloat("12.5"));      //返回12.5
    console.log(parseFloat("12.23.34"));  //返回12.23
    console.log(parseFloat("098.12"));    //返回98.12
</script>

</html>